package ModelTest;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class HTMLWriter {
	
	String path = "./html/";
	File fic ;
	String pmer ;
	Bdd bdd ;
	
	public HTMLWriter(Bdd bdd) {
		fic = new File(path + "index.html") ;
		this.bdd = bdd ;
	}
	
	public void ecrit() throws FileNotFoundException {
		PrintWriter out = new PrintWriter(fic) ;
		out.println("<!DOCTYPE html>");
		out.println("<html>");
		out.println("<head>");
		out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">");
		out.println("<meta http-equiv=\"refresh\" content=\"60\">");
		out.println("<title>Essai refresh</title>");
		out.println("</head>");
		out.println("<body>");
		out.println("Date : " ) ;
		out.println("Pmer : " + pmer) ;
		out.println("</br>") ;
		out.println("Pom : " + bdd.getLastObs().getValue("POM")) ;
		out.println("</body>");
		out.println("</html>");

		out.close();
	}
	
	public void setPmer(String st) {
		pmer = st ;
	}
	
	
}
